import numpy as np


# 求矩阵 U 每列最大元素所在行
# 调用格式: mr = maxrowf(U)
def MaxRowF(U):
    row = U.shape[0]  # 行
    col = U.shape[1]  # 列
    # 存取结果
    res = np.zeros(col)
    for j in range(col):
        maxC = U[0][j]
        for i in range(1, row):
            if maxC < U[i][j]:
                maxC = U[i][j]
                res[j] = i

    return res
